package com.yan.demo;

import java.util.Arrays;

public class Demo3 {
    public static void main(String[] args) {
        String str = "123";
        Reverse rev = new Reverse() {
            @Override
            public String rever(String str) {
                char[] chars = str.toCharArray();
                for (int i = 0 , j = chars.length - 1; i < str.length() / 2; i++ , j--) {
                    char temp = chars[i];
                    chars[i] = chars[j];
                    chars[j] = temp;
                }
               return new String(chars);
            }
        };
        str = rev.rever(str);
        System.out.println(str);
    }
}
